﻿<%@ Page Title="Change Password - Savory Housing" Language="C#" MasterPageFile="~/administrator/Admin.Master"
    AutoEventWireup="true" CodeBehind="Change_Password.aspx.cs" Inherits="WebApplication.administrator.Change_Password" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPhead" runat="server">
    <script language="javascript" type="text/javascript">
        function CheckConfirmPassword() {
            var button = document.getElementById('CPAdmin_btn_Update');
            var result = true;
            var Password = document.getElementById('CPAdmin_txt_NewPassword');
            var ConfirmPassword = document.getElementById('CPAdmin_txt_ConfirmNewPassword');
            if (ConfirmPassword.value != Password.value) {
                document.getElementById('CPAdmin_txt_ConfirmNewPassword').value = "";
                document.getElementById('div_PasswordError').style.display = "block";
            }
            else {
                document.getElementById('div_PasswordError').style.display = "none";

            }
        }
        function CheckRequiredFields() {

            var OldPassord = document.getElementById('CPAdmin_txt_OldPassword');
            var Password = document.getElementById('CPAdmin_txt_NewPassword');
            var ConfirmPassword = document.getElementById('CPAdmin_txt_ConfirmNewPassword');
            if (OldPassord.value == '' || Password.value == '' || ConfirmPassword.value == '') {
                return false;

            }
            return true;
        }
        function checkPageValidity() {

            var result = true;

            if (result = CheckRequiredFields()) {
                document.getElementById('div_error').style.display = "none";
                return true;
            }
            else {
                document.getElementById('div_error').style.display = "block";
                document.getElementById('msg_bx1').innerHTML = '* marked fields are required.';
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPAdmin" runat="server">
    <!-- Admin Left Area Start -->
    <div class="admin-left">
        <ul>
            <li><a href="My_Profile.aspx">My Profile</a></li>
            <li><a href="Change_Password.aspx" class="active">Change Password</a></li>
        </ul>
    </div>
    <!-- Admin Left Area End -->
    <div class="admin-right">
        <div class="error_box" id="div_error">
            <span class="fix_error" id="msg_bx1"></span>
            <br />
            <span class="error_description"></span>
        </div>
        <div id="div_UpdatePwdMsg" runat="server" style="display: none;">
            <h2 class="active_tick">
                Your password is updated successfully.</h2>
        </div>
        <div class="page_title">
            Change Password
        </div>
        <table class="form clearfix">
            <tr>
                <td>
                    <label>
                        <span class="red">*</span> Old Password:</label>
                </td>
                <td>
                    <asp:TextBox CssClass="form-text" ID="txt_OldPassword" runat="server" TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        <span class="red">*</span> New Password:</label>
                </td>
                <td>
                    <asp:TextBox CssClass="form-text" ID="txt_NewPassword" runat="server" TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        <span class="red">*</span> Confirm Password:</label>
                </td>
                <td>
                    <asp:TextBox CssClass="form-text" ID="txt_ConfirmNewPassword" runat="server" TextMode="Password"
                        Onblur="CheckConfirmPassword();"></asp:TextBox>
                    <div class="error_msg" id="div_PasswordError" style="display: none;">
                        <label class="errmsg_lbl">
                            Passwords do not match
                        </label>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button Text="Update" CssClass="reg-blue-round-btn w75" ID="btn_Update" runat="server"
                        OnClick="btn_Update_Click" OnClientClick="return checkPageValidity();" />
                </td>
                <td>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
